package com.txl.web.servlets;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.txl.pager.PageBean;
import com.txl.pager.QueryInfo;
import com.txl.service.ContactGroupService;
import com.txl.service.ContactService;
import com.txl.utils.WebUtils;

public class ContactListServlet extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		try{
			QueryInfo info = WebUtils.request2Bean(request, QueryInfo.class);
			
			ContactService service = new ContactService();
			PageBean pagebean= service.pageQuery(info);
			request.setAttribute("pagebean", pagebean);
			
			request.getRequestDispatcher("/page/contactlist.jsp").forward(request, response);
			
		}catch (Exception e) {
			e.printStackTrace();
			request.setAttribute("message", "查看联系人失败！！");
			request.getRequestDispatcher("/message.jsp").forward(request, response);
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		doGet(request, response);
	}

}
